package com.hp.bon.sgw.wh.mml.common;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

import com.hp.bon.sgw.bean.XmlMessage;

public class MMLSessionEntity {
	
	private XmlMessage xmlMsg = null;
	private PrintStream httpResponse = null;
	private String sessionId = null;
	private boolean isTimeout = false;
	private List<AckEntity> ackEntities = new ArrayList<AckEntity>();
	
	public static MMLSessionEntity buildEntity(XmlMessage xmlMsg, PrintStream httpResponse){
		MMLSessionEntity entity = new MMLSessionEntity();
		entity.setXmlMsg(xmlMsg);
		entity.setHttpResponse(httpResponse);
		return entity;
	}
	
	public XmlMessage getXmlMsg() {
		return xmlMsg;
	}
	public void setXmlMsg(XmlMessage xmlMsg) {
		this.xmlMsg = xmlMsg;
	}
	public PrintStream getHttpResponse() {
		return httpResponse;
	}
	public void setHttpResponse(PrintStream httpResponse) {
		this.httpResponse = httpResponse;
	}
	public String getSessionId() {
		return sessionId;
	}
	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}
	public void addAckEntity(AckEntity entity){
		ackEntities.add(entity);
	}
	public AckEntity getAckEntity(Integer ackType){
		for(AckEntity entity : ackEntities){
			if(entity.getAckType()==ackType){
				return entity;
			}
		}
		return null;
	}
	public boolean isTimeout() {
		return isTimeout;
	}
	public void setTimeout(boolean isTimeout) {
		this.isTimeout = isTimeout;
	}
}
